home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1999 February
/
EnigmA AMIGA RUN 34 (1999)(G.R. Edizioni)(IT)[!][issue 1999-02].iso
/
www
/
amitrix
/
swedish31.lha
/
Extras
/
AWebShell.rexx
next >
Wrap
OS/2 REXX Batch file
|
1997-09-28
|
4KB
|
150 lines
/* awebshell.rexx */
/*
* Låt användaren kontrollera AWeb genom tangentbordskommandon i ett
* skalfönster.
*
* Användning:
* rx AWebShell.rexx [skärmnamn]
*
* Normalt öppnas skalfönstret på den aktuella AWeb-skärmen.
*
* Starta det här programmet från AWeb (menyalternativet
* ARexx / Kör ARexx-program) eller konfigurera det i ARexx-menyn.
*/
options results
arg s_screen
s_port=address()
if left(s_port,5)='AWEB.' then do
s_awebport=s_port
s_title='from' s_port
end
else do
s_awebport=''
s_port='AWEB.NOPORT'
call checkport
s_title=''
end
address value s_port
if s_screen='' then do
'get screen'
s_screen=result
end
if ~open(s_con,'con:999/999/512/200/AWeb - Skal' s_title'/close/screen' s_screen) then exit
call writeln s_con,'AWebs skal. Skriv -h för hjälp.'
options failat 21
do forever
call checkport
call writech s_con,s_port'> '
s_inline=readln(s_con)
if eof(s_con) then exit
parse upper var s_inline s_kwd s_line
select
when s_kwd='-A' then do
parse upper var s_line s_nr .
s_newport='AWEB.'s_nr
if find(show('P'),s_newport)>0 then do
s_port=s_newport
end
else call writeln s_con,'Kunde inte hitta porten "'s_newport'".'
end
when s_kwd='-D' then do
call checkport
address value s_port
'open file://localhost/PROGDIR:docs/arexx/commands.html target AWebShellHelp'
'get port target AWebShellHelp'
if rc=0 then do
address value result
'window tofront'
end
end
when s_kwd='-H' then do
call writeln s_con,''
call writeln s_con,'Ange ett AWeb ARexx-kommando, eller ett av följande'
call writeln s_con,'utökade kommandon:'
call writeln s_con,''
call writeln s_con,'-A tal Adressera en annan AWeb-port'
call writeln s_con,'-D Visa ARexx-dokumentationen'
call writeln s_con,'-H Visa den här hjälpen'
call writeln s_con,'-S stam namn ... Visa alla STAM.#.NAMN [#=1..STAM.0]'
call writeln s_con,'-V var Visa variabeln VAR'
call writeln s_con,'-X Avsluta skalet'
call writeln s_con,''
call writeln s_con,'Obs: använd inte variabelnamn som börjar med "S_" i '
call writeln s_con,'argumenten VAR och STEM.'
call writeln s_con,''
end
when s_kwd='-S' then do
parse upper var s_line s_stem s_line
interpret 's_v=symbol("'s_stem'.0")'
if s_v='VAR' then do
s_nnames=0
do s_i=1 while s_line~=''
parse var s_line s_names.s_i s_line
s_nnames=s_i
end
interpret 's_v='s_stem'.0'
call writeln s_con,s_v 'Resultat:'
do s_j=1 to s_v
do s_i=1 to s_nnames
interpret 's_v='s_stem'.'s_j'.'s_names.s_i
call writeln s_con,s_stem'.'s_j'.'s_names.s_i'="'s_v'" '
end
end
end
else call writeln s_con,'Kunde inte hitta stamvariabeln "'s_stem'".'
end
when s_kwd='-V' then do
parse upper var s_line s_name .
interpret 's_v='s_name
call writeln s_con,s_name'="'s_v'"'
end
when s_kwd='-X' then exit
when s_inline~='' then do
drop result
call checkport
address value s_port
''s_inline
if rc>1 then do
call writeln s_con,'Fel:' errortext(rc)
end
else do
if symbol('RESULT')='VAR' then do
call writeln s_con,'RESULT="'result'"'
end
end
end
otherwise
end
end
checkport: procedure expose s_port s_awebport
ports=show('P')
if find(ports,s_port)=0 then do
if s_awebport=s_port then exit /* Must end or else window won't close */
nr=''
parse var ports dummy 'AWEB.' nr .
if nr='' then exit
address value 'AWEB.'nr
'get activeport'
s_port=result
end
return
errortext: procedure
parse arg code
select
when code=5 then e='Kommandot kunde inte utföras'
when code=10 then e='Ogiltiga argument'
when code=11 then e='Ogiltigt kommando'
when code=20 then e='Internt fel'
otherwise e='Okänd felkod:' code
end
return e